<HTML>
	<HEAD>	
		<script type="text/javascript" src="<?=$base?>bud/css/numericvalidation.js" ></script>		
	</HEAD>
<BODY>
<?php
	$delete = "<img src=".base_url()."/images/icons/fugue/eraser.png border=0 />";
	$update = "<img src=".base_url()."/images/icons/fugue/pencil.png border=0 />";

	function convert($val){
		if($val>=1){
			return (TRUE);
		}else{
			return (FALSE);
		}
	}


	if($menus=='view'){
		echo "<H2>Budget versi : $versi</H2>";
		$template = array(
			'table_open' => '<table border= "1" class="table" width="500">',
			'table_close' => '</table>'
		);

		echo form_open('bud/bud_activity/view');
		$this->table->set_template($template);
		$this->table->set_heading('Versi','KPU','PU','Program');
	
		$this->table->add_row(form_dropdown('versi',$option['option_versi']),form_dropdown('kpu',array(''=>'')+$option['option_kpu']),form_dropdown('pu',array(''=>'')+$option['option_pu']),form_dropdown('program',array(''=>'')+$option['option_program']));
		echo $this->table->generate();
		echo form_submit('submit','Go');
		echo form_close();
		//-----------------------------------
		$this->table->clear();
		
		$template = array(
			'table_open' => '<table border= "1" class="table" width="1500">',
			'table_close' => '</table>'
		);

		$this->table->set_template($template);
		
		if(count($content)!=0){
			$this->table->set_heading('','Id_Aktivitas', 'Nama_Aktivitas', 'Deskripsi_Aktivitas','Gaji','Barang_tidak habis','Barang_habis','Perjalanan','Jasa','Volume','Id_Source','Id_Unit','Id_Yayasan'); 
			foreach ($content as $row){
				$this->table->add_row(anchor('bud/bud_activity/delete/'.$row->id,$delete,'onclick="return confirmDelete();"')."<BR>".anchor('bud/bud_activity/update/'.$row->id,$update),$row->key,$row->name_activity,$row->desc_activity,$row->gaji_honor,$row->barang_tak_habis,$row->barang_habis,$row->perjalanan,$row->jasa_honor_ext,$row->volume,$row->key_bud_r_sumber,$row->key_bud_r_unit,$row->key_bud_m_yayasan_activity);
			}
			echo $this->table->generate();
		}else{
			echo "<FONT size=4 color=#FF0000>Nothing to display</FONT>";
		}
		$this->table->clear();
	}else if($menus=='add'){
		$tmpl= array (
				'table_open' => '<table border= "1" class="table">',
		);
		
		$inner_table = new $this->table();;
		
		$inner_table->set_heading('Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
		$inner_table->add_row(form_checkbox('1','1'),form_checkbox('2','1'),form_checkbox('3','1'),form_checkbox('4','1'),form_checkbox('5','1'),form_checkbox('6','1'),form_checkbox('7','1'),form_checkbox('8','1'),form_checkbox('9','1'),form_checkbox('10','1'),form_checkbox('11','1'),form_checkbox('12','1'));
	
		
		$template = array(
			'table_open' => '<table border= "1" class="table">',
			'table_close' => '<TR><TD colspan="3" bgcolor="#dddddd" align="center">'.form_checkbox('operasional','1',convert($record->operational)).'Kegiatan operasional'.'</TD></TR><TR><TD colspan="3" bgcolor="#dddddd" align="center">'.$inner_table->generate().'<BR>'.form_submit('submit','Save').'</TD></TR></table>'
		);
		
		$this->table->set_template($template);
		
		echo form_open('bud/bud_activity/insert');
		//$this->table->add_row('Versi',form_dropdown('id_versi',$option['option_versi']),'');
		$this->table->add_row('Id_Program--Id_aktivitas',form_dropdown('id_program',$option['option_program']).'--'.form_input(array('name'=>'id_activity','onkeyup'=>'strip_nonnumeric(this); strip_2digit(this);')),'Masukkan Single Integer Value dalam Activity contoh : 01,02,10,11');
		$this->table->add_row('Nama_aktivitas',form_input('name_activity'),'');
		$this->table->add_row('Deskripsi_Aktivitas',form_textarea('desc_activity'),'');
		$this->table->add_row('Gaji',form_input(array('name'=>'gaji_honor','onkeyup'=>'strip_nonnumeric(this)')),'');
		$this->table->add_row('Barang_tidak habis',form_input(array('name'=>'barang_tak_habis','onkeyup'=>'strip_nonnumeric(this)')),'');
		$this->table->add_row('Barang_habis',form_input(array('name'=>'barang_habis','onkeyup'=>'strip_nonnumeric(this)')),'');
		$this->table->add_row('Perjalanan',form_input(array('name'=>'perjalanan','onkeyup'=>'strip_nonnumeric(this)')),'');
		$this->table->add_row('Jasa',form_input(array('name'=>'jasa_honor_ext','onkeyup'=>'strip_nonnumeric(this)')),'');
		$this->table->add_row('Volume',form_input('volume'),'');
		$this->table->add_row('Id_Sumber',form_dropdown('id_source',$option['option_source']),'');
		$this->table->add_row('Id_Unit',form_dropdown('id_unit',$option['option_unit']),'');
		$this->table->add_row('Id_Yayasan',form_dropdown('id_yayasan',$option['option_yayasan']),'');
		
		echo $this->table->generate();
		$this->table->clear();
		echo form_close();
	}else if($menus=='update'){
		$tmpl= array (
				'table_open' => '<table border= "1" class="table">',
		);
		
		$inner_table = new $this->table();
		
		$inner_table->set_heading('Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
		$inner_table->add_row(form_checkbox('1','1',convert($record->januari)),form_checkbox('2','1',convert($record->februari)),form_checkbox('3','1',convert($record->maret)),form_checkbox('4','1',convert($record->april)),form_checkbox('5','1',convert($record->mei)),form_checkbox('6','1',convert($record->juni)),form_checkbox('7','1',convert($record->juli)),form_checkbox('8','1',convert($record->agustus)),form_checkbox('9','1',convert($record->september)),form_checkbox('10','1',convert($record->oktober)),form_checkbox('11','1',convert($record->november)),form_checkbox('12','1',convert($record->desember)));
	
		
		$template = array(
			'table_open' => '<table border= "1" class="table">',
			'table_close' => '<TR><TD colspan="3" bgcolor="#dddddd" align="center">'.form_checkbox('operasional','1').'Kegiatan operasional'.'</TD></TR><TR><TD colspan="3" bgcolor="#dddddd" align="center">'.$inner_table->generate().'<BR>'.form_submit('submit','Save').'</TD></TR></table>'
		);
		

		$this->table->set_template($template);

		echo form_open('bud/bud_activity/process_update');
		echo form_hidden('id',$record->id);
		$this->table->add_row('Versi',form_dropdown('id_versi',$option['option_versi'],$record->key_bud_m_version),'');
		$this->table->add_row('Id_Program--Id_aktivitas',form_dropdown('id_program',$option['option_program'],$record->key_bud_m_program).'--'.form_input(array('name'=>'id_activity','onkeyup'=>'strip_nonnumeric(this); strip_2digit(this);','value'=>substr($record->key,-2))),'Masukkan Single Integer Value dalam Activity contoh : 01,02,10,11');
		$this->table->add_row('Nama_aktivitas',form_input('name_activity',$record->name_activity),'');
		$this->table->add_row('Deskripsi_aktivitas',form_textarea('desc_activity',$record->desc_activity),'');
		$this->table->add_row('Gaji',form_input(array('name'=>'gaji_honor','onkeyup'=>'strip_nonnumeric(this)', 'value'=>$record->gaji_honor)),'');
		$this->table->add_row('Barang_tidak habis',form_input(array('name'=>'barang_tak_habis','onkeyup'=>'strip_nonnumeric(this)', 'value'=>$record->barang_tak_habis)),'');
		$this->table->add_row('Barang_habis',form_input(array('name'=>'barang_habis','onkeyup'=>'strip_nonnumeric(this)','value'=>$record->barang_habis)),'');
		$this->table->add_row('Perjalanan',form_input(array('name'=>'perjalanan','onkeyup'=>'strip_nonnumeric(this)','value'=>$record->perjalanan)),'');
		$this->table->add_row('Jasa',form_input(array('name'=>'jasa_honor_ext','onkeyup'=>'strip_nonnumeric(this)','value'=>$record->jasa_honor_ext)),'');
		$this->table->add_row('Volume',form_input('volume',$record->volume),'');
		$this->table->add_row('Id_Source',form_dropdown('id_source',$option['option_source'],$record->key_bud_r_sumber),'');
		$this->table->add_row('Id_Unit',form_dropdown('id_unit',$option['option_unit'],$record->key_bud_r_unit),'');
		$this->table->add_row('Id_Yayasan',form_dropdown('id_yayasan',$option['option_yayasan'], $record->key_bud_m_yayasan_activity),'');
		
		echo $this->table->generate();
		$this->table->clear();
		echo form_close();
	}
?>
</BODY>
</HTML>